<script setup lang="ts">
import { onLaunch, onShow } from '@dcloudio/uni-app'
import { useAppStore } from './stores/app'
import { useUserStore } from './stores/user'
const appStore = useAppStore()
const { getUser } = useUserStore()

onShow(async (option) => {
	let id  = option.query?.agentId || 0;
	if(id <= 0){
		id = option.query?.scene || 0;
	}
	uni.setStorageSync("MYID",id);
		// console.log("ID",id);
	uni.getLocation({
		// gcj02(用于打开微信地图查看位置) wgs84(返回全球定位系统坐标)
		type: 'gcj02',
		success(res) {
					console.log("开始获取位置")
			console.log(res)
			uni.setStorageSync("latlng", {
				lat: res.latitude,
				lng: res.longitude,
			});
		},
		fail(res) {
			console.log("获取失败")
			console.log(res)
		}
		
	});
})

onLaunch(async () => {
    await appStore.getConfig()
    // #ifdef H5
    const { status, page_status, page_url } = appStore.getH5Config
    if (status == 0) {
        if (page_status == 1) return (location.href = page_url)
        uni.reLaunch({ url: '/pages/empty/empty' })
    }
    // #endif
    await getUser()
	
	// #ifdef MP-WEIXIN
		if (wx.canIUse('getUpdateManager')) {
			const updateManager = wx.getUpdateManager();
			updateManager.onCheckForUpdate(function(res) {
				// 请求完新版本信息的回调
				if (res.hasUpdate) {
					updateManager.onUpdateReady(function() {
						// that.tui.modal('更新提示', '新版本已经上线啦~，为了获得更好的体验，建议立即更新', false, res => {
							// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
							updateManager.applyUpdate();
						// });
					});
					updateManager.onUpdateFailed(function() {
						// 新的版本下载失败
						// that.tui.modal('更新失败', '新版本更新失败，为了获得更好的体验，请您删除当前小程序，重新搜索打开', false, res => {});
					});
				}
			});
		}
		// #endif
})
</script>
<style lang="scss">
	
	.cor_548{
		color: #FC9548 !important;
	}
	
//
 /*每个页面公共css */
  
  view,
  image,
  button,
  text,
  input,
  textarea,
  swiper,
  scroll-view {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }
  
  .flex_box {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    width: 100%;
  }
  
  .flex_box .item {
    display: block;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
  }
  
  /**flex 设置**/
  .fldr {flex-direction: row;-webkit-flex-direction: row;}
  .fldc{flex-direction: column;-webkit-flex-direction: column;}
  .fldrr {flex-direction: row-reverse; -webkit-flex-direction: column-reverse}
  .jcsb  {justify-content: space-between;-webkit-justify-content: space-between;}
  .jcsba {justify-content: space-around;-webkit-justify-content: space-around;}
  .jcfs  {justify-content: flex-start;-webkit-justify-content: flex-start;}
  .jcc   {justify-content: center; -webkit-justify-content: center}
  .jcfe {justify-content: flex-end;-webkit-justify-content: flex-end}
  .df{ display: -webkit-flex; display: flex}
  .dif { display: inline-flex; }
  
  .aic {
    align-items: center;
  }
  
  .aie {
    align-items: flex-end;
  }
  
  .jcc {
    justify-content: center;
  }
  
  .fw {
    flex-wrap: wrap;
    -webkit-flex-wrap: wrap;
  }
  
  .clamp_1 {
    text-overflow: ellipsis;
    box-orient: vertical;
    line-clamp: 1;
    overflow: hidden;
  }
  
  .clamp_2 {
    text-overflow: ellipsis;
    box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
  }
  
  .clamp_3 {
    // text-overflow: ellipsis;
    // box-orient: vertical;
    // line-clamp: 3;
    // overflow: hidden;
	
	display: -webkit-box;
	  -webkit-line-clamp: 3;  
	  -webkit-box-orient: vertical;  
	  overflow: hidden;  
	  text-overflow: ellipsis;  
	  white-space: normal; /* 确保文本正确换行 */
  }
  
  .clamp_4 {
	  
	  display: -webkit-box;  
	    -webkit-line-clamp: 4;  
	    -webkit-box-orient: vertical;  
	    overflow: hidden;  
	    text-overflow: ellipsis;  
	    white-space: normal; /* 确保文本正确换行 */
	  
    // text-overflow: ellipsis;
    // box-orient: vertical;
    // line-clamp: 4;
    // overflow: hidden;
  }
  
  .ell {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  .vm { vertical-align: middle; }
  .vt { vertical-align: top; }
  
  /**字体**/
  .fs0 { font-size: 0; }
  .fs12 {  font-size: 12rpx;}
  .fs14 {  font-size: 14rpx;}
  .fs16 {  font-size: 16rpx;}
  .fs18 {  font-size: 18rpx;}
  .fs20 {  font-size: 20rpx;}
  .fs22 {  font-size: 22rpx;}
  .fs24 {  font-size: 24rpx;}
  .fs26 {  font-size: 26rpx;}
  .fs28 {  font-size: 28rpx;}
  .fs30 {  font-size: 30rpx;}
  .fs32 {  font-size: 32rpx;}
  .fs34 {  font-size: 34rpx;}
  .fs36 {  font-size: 36rpx;}
  .fs38 {  font-size: 38rpx;}
  .fs40 {  font-size: 40rpx;}
  .fs42 {  font-size: 42rpx;}
  .fs44 {  font-size: 44rpx;}
  .fs46 {  font-size: 46rpx;}
  .fs48 {  font-size: 48rpx;}
  .fs50 {  font-size: 50rpx;}
  .fs54 {  font-size: 54rpx;}
  .fs58 {  font-size: 58rpx;}
  .fs60 {  font-size: 60rpx;}
  .fs64 {  font-size: 64rpx;}
  .fs66 {  font-size: 66rpx;}
  .fs68 {  font-size: 68rpx;}
  .fs70 {  font-size: 70rpx;}
  .fs80 {  font-size: 80rpx;}
  .fs84 {  font-size: 84rpx;}
  .fs100{  font-size: 100rpx;}
  
  /* 行高 */
  .lh1 {line-height: 1}
  
  .lh54 { line-height: 54rpx; }
  .lh50 { line-height: 50rpx; }
  .lh44 { line-height: 44rpx; }
  .lh40  { line-height: 40rpx; }
  .lh38 { line-height: 38rpx; }
  .lh36 { line-height: 36rpx; }
  .lh34 { line-height: 34rpx; }
  .lh32 { line-height: 32rpx; }
  .lh26 { line-height: 26rpx; }
  
  /**距离 marging **/
  .mt5  {margin-top: 5rpx;}
  .mt10 {margin-top: 10rpx;}
  .mt15 {margin-top: 15rpx;}
  .mt20 {margin-top: 20rpx;}
  .mt25 {margin-top: 25rpx;}
  .mt30 {margin-top: 30rpx;}
  .mt35 {margin-top: 35rpx;}
  .mt40 {margin-top: 40rpx;}
  .mt45 {margin-top:45rpx;}
  .mt50 {margin-top: 50rpx;}
  .mt55 {margin-top: 55rpx;}
  .mt60 {margin-top: 60rpx;}
  .mt65 {margin-top: 65rpx;}
  .mt75 {margin-top: 75rpx;}
  .mt78 {margin-top: 78rpx;}
  
  .mb5{margin-bottom: 5rpx;}
  .mb10{margin-bottom: 10rpx;}
  .mb15{margin-bottom: 15rpx;}
  .mb20{margin-bottom: 20rpx;}
  .mb25{margin-bottom: 25rpx;}
  .mb30{margin-bottom: 30rpx;}
  .mb35{margin-bottom: 35rpx;}
  .mb40{margin-bottom: 40rpx;}
  .mb45{margin-bottom: 45rpx;}
  .mb50{margin-bottom: 50rpx;}
  
  .ml5 {margin-left: 5rpx;}
  .ml10 {margin-left: 10rpx;}
  .ml12 {margin-left: 12rpx;}
  .ml15 {margin-left: 15rpx;}
  .ml20 {margin-left: 20rpx;}
  .ml25 {margin-left: 25rpx;}
  .ml30 {margin-left: 30rpx;}
  .ml35 {margin-left: 35rpx;}
  .ml40 {margin-left: 40rpx;}
  .ml45 {margin-left: 45rpx;}
  .ml50 {margin-left: 50rpx;}
  .ml60 {margin-left: 60rpx;}
  .ml80 {margin-left: 80rpx;}
  
  .mr5 {margin-right: 5rpx;}
  .mr10 {margin-right: 10rpx;}
  .mr15 {margin-right: 15rpx;}
  .mr17 { margin-right: 17rpx; }
  .mr20 {margin-right: 20rpx;}
  .mr25 {margin-right: 25rpx;}
  .mr30 {margin-right: 30rpx;}
  .mr35 {margin-right: 35rpx;}
  .mr40 {margin-right: 40rpx;}
  .mr45 {margin-right: 45rpx;}
  .mr50 {margin-right: 50rpx;}
  .mr65 {margin-right: 65rpx;}
  
  .mar_auto {margin-left: auto; margin-right: auto;}
  
  .pa10 { padding: 10rpx; }
  .pa15 { padding: 15rpx; }
  .pa20 { padding: 20rpx; }
  .pa25 { padding: 25rpx; }
  .pa30 { padding: 30rpx; }
  .pa35 { padding: 35rpx; }
  
  .pt5 {padding-top: 5rpx;}
  .pt10 {padding-top: 10rpx;}
  .pt15 {padding-top: 15rpx;}
  .pt20 {padding-top: 20rpx;}
  .pt25 {padding-top: 25rpx;}
  .pt30 {padding-top: 30rpx;}
  .pt35 {padding-top: 35rpx;}
  .pt40 {padding-top: 40rpx;}
  .pt45 {padding-top: 45rpx;}
  .pt50 {padding-top: 50rpx;}
  .pt55 {padding-top: 55rpx;}
  .pt60 {padding-top: 60rpx;}
  
  .pb5 {padding-bottom: 5rpx;}
  .pb10 {padding-bottom: 10rpx;}
  .pb15 {padding-bottom: 15rpx;}
  .pb20 {padding-bottom: 20rpx;}
  .pb25 {padding-bottom: 25rpx;}
  .pb30 {padding-bottom: 30rpx;}
  .pb35 {padding-bottom: 35rpx;}
  .pb40 {padding-bottom: 40rpx;}
  .pb45 {padding-bottom: 45rpx;}
  .pb50 {padding-bottom: 50rpx;}
  .pb80 {padding-bottom: 80rpx;}
  
  .pl5 { padding-left: 5rpx; }
  .pl10 { padding-left: 10rpx; }
  .pl15 { padding-left: 15rpx; }
  .pl20 { padding-left: 20rpx; }
  .pl25 { padding-left: 25rpx; }
  .pl30 { padding-left: 30rpx; }
  .pl35 { padding-left: 35rpx; }
  .pl40 { padding-left: 40rpx; }
  .pl45 { padding-left: 45rpx; }
  .pl50 { padding-left: 50rpx; }
  .pl60 { padding-left: 60rpx; }
  
  .pr5 { padding-right: 5rpx; }
  .pr10 { padding-right: 10rpx; }
  .pr15 { padding-right: 15rpx; }
  .pr20 { padding-right: 20rpx; }
  .pr25 { padding-right: 25rpx; }
  .pr30 { padding-right: 30rpx; }
  .pr35 { padding-right: 35rpx; }
  .pr40 { padding-right: 40rpx; }
  .pr45 { padding-right: 45rpx; }
  .pr50 { padding-right: 50rpx; }
  .pr60 { padding-right: 60rpx; }
  
  .fwb { font-weight: bold; }
  
  .re { position: relative; }
  
  .dn { display: none; }
  
  .vh { visibility: hidden; }
  
  .scaley_1 {
    position: relative;
  }
  
  .scaley_1:after {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #e6e6e6;
    content: '';
    height: 1px;
    -webkit-transform: scaleY(.5);
    transform: scaleY(.5);
  }
  
  .wp100 { width: 100%; }
  .wp50 { width: 50%; }
  .wp33 { width: 33%; }
  .wp25 { width: 25%; }
  
  .w315 { width: 315rpx; }
  .w295 { width: 295rpx; }
  .w200 { width: 200rpx; }
  .w185 { width: 185rpx; }
  .w150 { width: 150rpx; }
  .w145 { width: 145rpx; }
  .w115 { width: 115rpx; }
  
  .hp100 { height: 100%; }
  
  .mt-20 { margin-top: -20rpx; }
  
  .mr-15 { margin-right: -15rpx; }
  
  .tal { text-align: left; }
  .tac { text-align: center; }
  .tar { text-align: right; }
  
  .ov { overflow: hidden; }
  
  .em_ell_4 {
    width: 5em;
  }
  
  .r_bt1 { border-top: 1px solid #EEEEE0; }
  
  .r_bl1 { border-left: 5rpx dashed #F8F8F8; }
  
  .r_bb1 { border-bottom: 1px solid #eee; }
  .r_bb2 { border-bottom: 1px solid #E7E7E7; }

  
  .bgf { background-color: #fff; }
  .bg1 { background: #F7F8FA; }
  
  .cor_666{color:#666;}
  .cor_999{color:#999;}
  .cor_333{color:#333;}
  .cor_000{color:#000;}
  .cor_fff{color:#fff;}
  .cor_ccc { color: #ccc; }
  .cor_aaa { color: #aaa; }
  .cor_EDB { color: #EDB703; }
  .cor_EC0 { color: #EC0D0D; }
  .cor_19E { color: #F7DA1C; }
  .cor_F8F { color: #F8FBFD; }
  .cor_FF7 { color: #FF7E07; }
  .cor_FFB { color: #FFBD00; }
  .cor_bbb { color: #bbb; }
  .cor_F46 { color: #F46405; }
  .cor_A1A { color: #A1A1A1; }
  .cor_16E { color: #F7DA1C; }
  
  .img_1 { width: 34rpx; height: 34rpx; }
  .img_2 { width: 30rpx; height: 30rpx; }
  .img_3 { width: 120rpx; height: 120rpx; border-radius: 10rpx; object-fit: cover; }
  .img_4 { width: 20rpx; height: 20rpx; }
  .img_5 { width: 68rpx; height: 68rpx; border-radius: 50%; object-fit: cover; }
  .img_6 { width: 84rpx; height: 84rpx; }
  .img_7 { width: 126rpx; height: 126rpx; border: 4rpx solid #fff; border-radius: 50%; }
  .img_8 { width: 45rpx; height: 45rpx; }
  .img_9 { width: 78rpx; height: 78rpx; }
  .img_10 { width: 48rpx; height: 48rpx; }
  .img_11 { width: 78rpx; height: 78rpx; border-radius: 50%; }
  .img_12 { width: 161rpx; height: 90rpx; }
  
  
  .box { line-height: 1; }
  
  page { line-height: 1;color: #333; }
  
  .r_btn_1,.r_btn_3 {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 148rpx;
    height: 58rpx;
    font-size: 26rpx;
    color: #aaa;
    border-radius: 39rpx;
    border: 1px solid #AAAAAA;
  }
  
  .r_btn_2 {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 148rpx;
    height: 58rpx;
    font-size: 26rpx;
    color: #fff;
    background: linear-gradient(180deg, rgba(255,73,7,.6) 0%, rgba(255,73,7,1) 100%);
    //box-shadow: 0rpx 5rpx 20rpx 0rpx rgba(41,255,154,0.5);
    border-radius: 39rpx;
  }
  
  .r_btn_3 {
    color: #F7DA1C;
    border-color: #F7DA1C;
  }
  
  .r_btn_4 {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 78rpx;
    font-size: 30rpx;
    color: #fff;
	background-color: #FF4907;
    // background: linear-gradient(180deg, #F7DA1C 0%, #ffc200 100%);
    // box-shadow: 0rpx 10rpx 30rpx 0rpx rgba(41,255,154,0.5);
    border-radius: 39rpx;
  }
  
  /* 自定义导航栏 */
  .navbar {
  	position: fixed;
  	top: 0;
  	left: 0;
  	width: 100%;
  	background: #fff;
  	z-index: 10000;
  	overflow: hidden;
  }
  
  .navbar .nav_title_pos {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 750rpx;
    height: 100%;
    font-weight: bold;
    font-size: 36rpx;
    color: #000;
    text-align: center;
    z-index: 2;
  }
  
  // 底部按钮区域样式
  .r_fix_btn_bottom {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 30rpx 30rpx calc(30rpx + env(safe-area-inset-bottom));
    background: #fff;
    z-index: 5;
  }
  
  /* 底部菜单栏 */
  .menu_bottom_fix {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    z-index: 5;
  }
  
  .menu_bottom_bg {
    position: relative;
    width: 100%;
    padding: 0 0 calc(10rpx + env(safe-area-inset-bottom));
    // padding-bottom: env(safe-area-inset-bottom);
    // height: calc(100rpx + env(safe-area-inset-bottom));
    background-color: #fff;
    z-index: 3;
  }
  
  .menu_add_pos {
    position: absolute;
    top: -41rpx;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 110rpx;
    height: 110rpx;
    padding: 0 26rpx;
    font-size: 28rpx;
    line-height: 32rpx;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(180deg, #1FDBE5 0%, #42E18C 100%);
    border-radius: 55rpx;
    transform: translateX(-50%);
    z-index: 5;
  }
  
  .menu_bottom_img_pos {
    position: absolute;
    top: -64rpx;
    left: 0;
    width: 100%;
    height: 64rpx;
    z-index: 4;
  }
  /* 底部菜单栏 */
  
  .prev_page_pos {
    position: fixed;
    top: 80rpx;
    left: 30rpx;
    width: 58rpx;
    height: 58rpx;
    z-index: 5;
  }
</style>
